package cn.daimajiangxin.springboot.learning.controller;

import cn.daimajiangxin.springboot.learning.kafka.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KafkaController {

   private final  KafkaProducer kafkaProducer;

    @Autowired
    public KafkaController(KafkaProducer kafkaProducer) {
        this.kafkaProducer = kafkaProducer;
    }

    @GetMapping("/kafka")
    public void kafka() {
         kafkaProducer.sendMessage("Hello World");
    }
}
